package com.adcc.ags.gms.user.vo;

import com.adcc.ags.gms.core.entity.BaseEntity;
import com.adcc.ags.gms.core.vo.BaseVO;
import com.adcc.ags.gms.user.entity.GWUser;
import com.fasterxml.jackson.core.JsonProcessingException;

import java.text.ParseException;

/**
 * 用户树型节点视图
 */
public class GWUserNodeVO extends BaseVO {

    // ID
    private long id;

    // 文本
    private String text;

    // 是否选中
    private boolean selected;

    /**
     * 构造函数
     */
    public GWUserNodeVO(){

    }

    /**
     * 构造函数
     * @param user
     */
    public GWUserNodeVO(GWUser user){
        if(user != null){
            id = user.getId();
            text = user.getUserName();
        }
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    @Override
    public BaseEntity toEntity() throws ParseException {
        GWUser user = new GWUser();
        user.setId(id);
        user.setUserName(text);
        return null;
    }

    @Override
    public String toJson() throws JsonProcessingException {
        return null;
    }
}
